package com.hltx.controller.rebateannal;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hltx.controller.base.BaseController;
import com.hltx.pojo.common.Page;
import com.hltx.pojo.rebateannal.Bill;
import com.hltx.pojo.user.User;
import com.hltx.service.rebateannal.BillManager;
import com.hltx.util.ResultInfo;
/**
 * 账单controller
 */
@Controller
@RequestMapping("/bill")
public class BillController extends BaseController{
	@Resource(name="billService")
	private BillManager billService;
	
	/**
	 * 打开账单列表
	 */
	@RequestMapping
	public String index() {
		return "rebateannal/rebate_annal";
	}
	
	/**
	 * 打开账单列表
	 */
	@RequestMapping(value = "/biiList",method = { RequestMethod.POST})
	@ResponseBody
	public Map<String, Object> addrebiiListssList(Page page,HttpServletRequest request){
		this.logBefore(logger, "查询账单列表");
		Map<String, Object> resMap = new HashMap<String, Object>();
		try {
			User user=(User) request.getSession().getAttribute("sessionUser");
			page.getParams().put("userid", user.getId());
			List<Bill> billList=billService.getBillList(page);
			
			resMap.put("billList", billList);
			resMap.put("result", this.initResult(ResultInfo.SUCCESS, "ok", ""));
		} catch (Exception e) {
			e.printStackTrace();
			this.logError(logger, e.getMessage());
			resMap.put("result", this.initResult(ResultInfo.ERROR, "exception", "系统异常"));
		}
		this.logAfter(logger);
		return resMap;
	}
}
